//
//  MD5_Utils.m
//  TaurusXi
//
//  Created by xicheng on 15/12/11.
//  Copyright © 2015年 xicheng. All rights reserved.
//

#import "MD5_Utils.h"
#include <CommonCrypto/CommonDigest.h>
@implementation MD5_Utils

+(NSString *)md5HexDigest:(NSString *)input{
  const char *cStr = [input UTF8String];
  unsigned char digest[CC_MD5_DIGEST_LENGTH];
  CC_MD5( cStr, input.length, digest );
  NSMutableString *result = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
  for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
    [result appendFormat:@"%02x", digest[i]];
  return result;
}

@end
